UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ypj50OsSBKPrpO+vfSUbwLxGqnvOtMbkgCtRZgNuF3o='
WHERE
key_id = 'a42f0b750b27ea9829fc4960236fc63a5e5cb56506097121926e29a306556819'
AND (
token = 'ypj50OsSBKPrpO+vfSUbwLxGqnvOtMbkgCtRZgNuF3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)