UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DaWeYUk4h40pky38FGrYxOUqYbD2+naaPbkYchYEpnU=' 
WHERE 
  key_id = '63e56908b7d5a85fd49f3fe183bff969a126872c356baee678cad8bd5b990d0c' 
  AND (
    token = 'DaWeYUk4h40pky38FGrYxOUqYbD2+naaPbkYchYEpnU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047