UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yiAIuD4cevQb7XjCpLknbt0i/7t0IxA7ELus+HerO10='
WHERE
key_id = 'c9a0543c3bc4ad6318446d92109f8ef16814ba473676cdc22e0b2ef66ee0cd7c'
AND (
token = 'yiAIuD4cevQb7XjCpLknbt0i/7t0IxA7ELus+HerO10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)