UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'le4Y0lDxCgaQNt3O6dBE2h8duUp3juW2EkV1iM1kd+s='
WHERE
key_id = '2cbddad824501500c02e04989f67773540bec84939f2d33fb048256b13ea5ce6'
AND (
token = 'le4Y0lDxCgaQNt3O6dBE2h8duUp3juW2EkV1iM1kd+s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)