UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+npS68VVJCJGqz694glKyrUJg4dfrHvlSIy2ysYbhw=' 
WHERE 
  key_id = '91b8cf7c4eb727a42a33ce3e6c97d9fe851d7d17987281015adeddc5339c2f9a' 
  AND (
    token = 'B+npS68VVJCJGqz694glKyrUJg4dfrHvlSIy2ysYbhw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030