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