UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'foJWAsfdM0EdhoQM6TrX5BKx4AvZ7Y0y6xQA6t5RB20='
WHERE
key_id = '3bfdfda969bf10ed69a1762581b72fb352039106c4c8fcc52363233f855505a4'
AND (
token = 'foJWAsfdM0EdhoQM6TrX5BKx4AvZ7Y0y6xQA6t5RB20='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)