UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '15a5071z3jFgwLXbAiFFpHoy4qOwcECDEQfQwHMHCCk='
WHERE
key_id = 'a07d1ffb46829a21fade351e70684352ce94dcfcd22f0f39bc3cfce708f188d1'
AND (
token = '15a5071z3jFgwLXbAiFFpHoy4qOwcECDEQfQwHMHCCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)