UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'joBFch5pwUB2qGZqvK9okYt+KOUNPuReRawZl0kKOUI='
WHERE
key_id = '8399c5765b2764ec4acd39882866f194657a2915a480657cbf00e26d6a56e7cb'
AND (
token = 'joBFch5pwUB2qGZqvK9okYt+KOUNPuReRawZl0kKOUI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)