UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fyo1fruAOqk+ldP/4U+Oneb1dJH3U9pp1krOIjx93vc='
WHERE
key_id = '1c59cc506563e0304b566a8deb2cf37af95339b1f270c6f2b5f2cdcbf7a99eac'
AND (
token = 'fyo1fruAOqk+ldP/4U+Oneb1dJH3U9pp1krOIjx93vc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)