UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dxPVi56SJadu3jw4Y52rQEwe7FHplz2+ywt5f8piKtA=' 
WHERE 
  key_id = '7c88a7e746e86ae611e92b47cfe2395c2bf49983dacb579d7466740913c05586' 
  AND (
    token = 'dxPVi56SJadu3jw4Y52rQEwe7FHplz2+ywt5f8piKtA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053