UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XdaghgKTbhnbhMpTQpqD8QA7HFhrkxvyWmkuj0nak8I='
WHERE
key_id = 'c5ed0b65dd2fdffa4a3073d62fad13b4ecc38a2ff869c8b3c1662ffdde10fb5d'
AND (
token = 'XdaghgKTbhnbhMpTQpqD8QA7HFhrkxvyWmkuj0nak8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)