UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h2+8Dn0zSi84RtG1U2x0VDC6GMT7E62XtWUa3wq9Aus=' 
WHERE 
  key_id = '35d245ee34b3e8c02c74d7be285435c021d4d94d6fbd358c8887800244df6b94' 
  AND (
    token = 'h2+8Dn0zSi84RtG1U2x0VDC6GMT7E62XtWUa3wq9Aus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036