UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UssceB84e/oclzFmdm3nGQSwqBH4zZ1YEs7hMCo4cZw='
WHERE
key_id = 'd639e1a4851c4e193e0b38721398e777e893a915a319b89edb1cca1156aa3e3c'
AND (
token = 'UssceB84e/oclzFmdm3nGQSwqBH4zZ1YEs7hMCo4cZw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)