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