UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yuOCf5s3+XFrgR+3QoQvC6gvxq9NNoAY5VACovQBsdg=' 
WHERE 
  key_id = 'c3ea47af6c89bfa6a5afbc6ac6126d252c086689fb5cfed905ddae3439721348' 
  AND (
    token = 'yuOCf5s3+XFrgR+3QoQvC6gvxq9NNoAY5VACovQBsdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039