UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WW4Eku7J7sLuU3mnpRPxCrQcgqx6TD6JetVZ7QLARJc=' 
WHERE 
  key_id = '5996c35c360ddb391aa6d43fac55faa3481c28824bcd887f2f6b0c2333e6a1ae' 
  AND (
    token = 'WW4Eku7J7sLuU3mnpRPxCrQcgqx6TD6JetVZ7QLARJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029