UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LqgFuEt97Iin8TNINrIHGFj3HWZjW7yitDlZOBGfTTY='
WHERE
key_id = 'e9f3c4ab7b9bf562411cad3cb790d9111e61e41b12f3805229b54ba55307687a'
AND (
token = 'LqgFuEt97Iin8TNINrIHGFj3HWZjW7yitDlZOBGfTTY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)