UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B0Bfn7JE/DKhYFUabX05LjdPfdhM9VqobjWPvAxjnsU='
WHERE
key_id = 'e30e52367f388833317bfd0e3b8373995ac7c0afbc07084b2d3e61e684ecda84'
AND (
token = 'B0Bfn7JE/DKhYFUabX05LjdPfdhM9VqobjWPvAxjnsU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)