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