UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ehsc2hjsQM4+1gu/QiAcb8Yi14NSX1futGmxuITsufg=' 
WHERE 
  key_id = 'aed190d53d6fee6d5e2ec1e60e215c5e44d3509646ab8f4a4f813029b52ac786' 
  AND (
    token = 'Ehsc2hjsQM4+1gu/QiAcb8Yi14NSX1futGmxuITsufg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029