UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n+K4fPakKL7k9ODJhaV+PL3ds/MocDKnQlq/D3aD87Y='
WHERE
key_id = 'a6385f7fd38c74b7d7ebdc3cda7eeed51cf6848ef8581dfe11cc30a84e46bb36'
AND (
token = 'n+K4fPakKL7k9ODJhaV+PL3ds/MocDKnQlq/D3aD87Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)