UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gi8lai2pGfKpM8Ue7PTKqeQAsxcr8AY6T+d4P3s18Hk=' 
WHERE 
  key_id = '750ecdff218235a46894e8af2f98b48d93b6ba38a4640df0b3ab46bc5b41147b' 
  AND (
    token = 'gi8lai2pGfKpM8Ue7PTKqeQAsxcr8AY6T+d4P3s18Hk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018