UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TpzvM7csqYkTTQZJGbb08il4/3g8oD0aPlZbvY3FX1k='
WHERE
key_id = 'b6e08b15681848587d1a30389373290d2df857121297591a5ee2e2b308370b73'
AND (
token = 'TpzvM7csqYkTTQZJGbb08il4/3g8oD0aPlZbvY3FX1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)