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