UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k10iG7hLB0Ba6vBqm6JfiYbDM1EHJ10KYlof0QAfDgo='
WHERE
key_id = '694085f01ec3cce9035e6bf4266910d7bc355170fa471e94dce943e66834aa70'
AND (
token = 'k10iG7hLB0Ba6vBqm6JfiYbDM1EHJ10KYlof0QAfDgo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)