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