UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IPxolfr1Xz5pi3O7Nt+1T7shzcYgsTD3BA2/edkpfVc=' 
WHERE 
  key_id = 'de15bd55085c6de0241996352a9b4f9c1c7ccae90bb644d5189e4a234a13ef08' 
  AND (
    token = 'IPxolfr1Xz5pi3O7Nt+1T7shzcYgsTD3BA2/edkpfVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045