UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UOgEgDq3Tg4o07MpR+2wY2ygDC8LA8Rz5rkmIs88vtU=' 
WHERE 
  key_id = '3c7263ef778413fca4c59585e2e23746f76a96e766d452ab5ef0bafaf4ca1b3c' 
  AND (
    token = 'UOgEgDq3Tg4o07MpR+2wY2ygDC8LA8Rz5rkmIs88vtU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040