UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2hpBzF30vXm4mb9RnwxhMxV7wF+6SdDEk0Oe4/8LrCs='
WHERE
key_id = '6383f9177f65f62a714bc0a11c46834c94581c6b90d1afdbe3c405145289b890'
AND (
token = '2hpBzF30vXm4mb9RnwxhMxV7wF+6SdDEk0Oe4/8LrCs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)