UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hsVqBJjFFLCQE1SRU9VyB/vXRlYIshxJIH9+pfxfBBs='
WHERE
key_id = '8fafabb8980512128e1e6beb395cb39f1b83e30a4dbbe44a8079088256a57561'
AND (
token = 'hsVqBJjFFLCQE1SRU9VyB/vXRlYIshxJIH9+pfxfBBs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)