UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dESoEhi47xCddaBL8BQmqucUPnsuyiiHOmn5Bbf4xZw=' 
WHERE 
  key_id = '9f7847021bc0217cbd5e901b4970fb8687c9a799ac3c4847e1ab43ac75ba937c' 
  AND (
    token = 'dESoEhi47xCddaBL8BQmqucUPnsuyiiHOmn5Bbf4xZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032