UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u7VQIZrOMoEUSnTYa8E8g/jdkx8PGK3wZruSlxitCbs='
WHERE
key_id = '42ba136802b35cf3a084954e6a299e1231166f0ee7d4430de59128566fa6a912'
AND (
token = 'u7VQIZrOMoEUSnTYa8E8g/jdkx8PGK3wZruSlxitCbs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)